/**
 * 
 */
package sa.edu.kaust.msc.cloud.mgmt.sim.domain;

import java.util.List;

import org.cloudbus.cloudsim.Pe;

import sa.edu.kaust.msc.cloud.mgmt.sim.exceptions.OutOfRangeCoreExeption;

/**
 * @author suzan
 *
 */
public class Server {
	
	private int hostId;
	private int ram; //host memory (MB)
	private long storage; //host storage
	private int bw = 10000;

	private Cores core; // core per server
	private List<Pe> coreList;
	public Server(int hostId, int ram, long storage, int numCores){
		this.hostId = hostId;
		this.ram = ram;
		this.storage = storage;
		
		initCores(numCores);
	}
	
	/**
	 * 
	 * @param numCores
	 */
	private void initCores(int numCores){
		 core = new Cores();
		 
		 try {
			 coreList = core.generateCore(numCores);
		} catch (OutOfRangeCoreExeption e) {
			e.printStackTrace();
		}
	}
	
	/**
	 * 
	 * @return
	 */
	public int getHostId() {
		return hostId;
	}

	/**
	 * 
	 * @param hostId
	 */
	public void setHostId(int hostId) {
		this.hostId = hostId;
	}

	/**
	 * 
	 * @return
	 */
	public int getRam() {
		return ram;
	}

	/**
	 * 
	 * @param ram
	 */
	public void setRam(int ram) {
		this.ram = ram;
	}

	/**
	 * 
	 * @return
	 */
	public long getStorage() {
		return storage;
	}

	/**
	 * 
	 * @param storage
	 */
	public void setStorage(long storage) {
		this.storage = storage;
	}
	
	/**
	 * 
	 * @return
	 */
	public int getBw() {
		return bw;
	}

	/**
	 * 
	 * @param bw
	 */
	public void setBw(int bw) {
		this.bw = bw;
	}

	/**
	 * 
	 * @return
	 */
	private Cores getCore() {
		return core;
	}
	
	/**
	 * 
	 * @return
	 */
	public List<Pe> getCoreList(){
		return coreList;
	}

}
